<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 300px;
            height: 200px;
            border: 1px solid black;
            margin: 0 auto;
            overflow: hidden;
            position: relative;
        }
        .box2{
            width: 900px;
            height: 200px;
            display: flex;
            position: absolute;
            animation: tbox 4s infinite alternate;
        }
        .skyblue{ 
            width: 300px;
            height: 200px;
            background-color: skyblue;
            text-align: center;
            line-height: 200px;
        }
        .red{
            width: 300px;
            height: 200px;
            background-color: red;
            text-align: center;
            line-height: 200px;
        }
        .green{
            width: 300px;
            height: 200px;
            background-color: green;
            text-align: center;
            line-height: 200px;
        }
        @keyframes tbox{
            0%{
                top:0px;
                left: 0px;
            }
            50%{
                top:0px;
                left:-300px;
            }
            100%{
                top:0px;
                left:-600px;
            }
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="box2">
            <div class="skyblue">skyblue</div>
        <div class="red">red</div>
        <div class="green">green</div>
        </div>
        
    </div>
</body>
</html>